<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>编辑公司信息</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/animate.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/style.min.css?v=4.1.0" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/css/bootstrap-fileinput/fileinput.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/jQuery-Validation/css/validationEngine.jquery.css" rel="stylesheet">
    <style type="text/css">
        
        body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";font-size:14px;}
        #l-map{height:700px;width:100%;}
        #r-result{width:100%;}
        *{margin:0;padding: 0;}
		.show{width: 625px; height:35px; margin:20px auto; position: relative; }
		.but{width: 110px; height: 39px; background: #0033cc; color:#fff; line-height: 39px; text-align: center; cursor: pointer; float: left; }
		.but:hover{background:#0066ff; }
		.search{width:100%; display: none;position: absolute; top: 37px; }
		.search ul{border:1px solid #ddd;}
		.search ul li{list-style: none; width: 502px; height: 30px; text-indent: 10px; line-height: 30px; }
		.search ul li a.cur{background: #ddd;}
		.search ul li a{color: #000; text-decoration: none; display: block; }
		.search ul li a:hover{background: #ddd; }
		.show span{display: inline-block; width:;}
	  *{
	      margin:0px;
	      padding:0px;
	  }
	  body, button, input, select, textarea {
	      font: 12px/16px Verdana, Helvetica, Arial, sans-serif;
	  }
	  p{
	      width:603px;
	      padding-top:3px;
	      overflow:hidden;
	  }
	  #container{
	    margin-top:50px;
	   	width:100%;
	    min-height:767px;
	    }
    </style>
</head>
<body class="gray-bg">
<div class="formErrorContent"></div>
    <div class="container-fluid" style="margin-top: 50px">
        <form class="form-horizontal" role="form" id="companyForm" enctype="multipart/form-data" autocomplete="off">
                <input type="hidden" name="comnumId" id="companyId">
                <div class="col-xs-12 col-md-6">
                	<div class="form-group">
	                    <label class="col-sm-4 control-label">企业名称:</label>
	                    <div class="col-sm-8">
	                        <input type="text" class="form-control validate[required]"
	                               name="comnumName" id="comnumName" placeholder="企业名称">
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-4 control-label">企业地址:</label>
	                    <div class="col-sm-8">
	                        <input type="text" class="form-control validate[required]"
	                               name="comnumAddress" id="comnumAddress" placeholder="企业地址">
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-4 control-label">执照编号:</label>
	                    <div class="col-sm-8">
	                        <input type="text" class="form-control validate[required]"
	                               name="comnumLicenceCode" id="comnumLicenceCode" placeholder="执照编号">
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-4 control-label">企业法人:</label>
	                    <div class="col-sm-8">
	                        <input type="text" class="form-control validate[required]" name="comnumCorp" 
	                        	id="comnumCorp" placeholder="企业法人">
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-4 control-label">身份证号:</label>
	                    <div class="col-sm-8">
	                        <input type="text" class="form-control" name="comnumIdCard" 
	                        	id="comnumIdCard" placeholder="身份证号">	
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-4 control-label">真实姓名:</label>
	                    <div class="col-sm-8">
	                        <input type="text" class="form-control" name="comnumRealName" 
	                        	id="comnumRealName" placeholder="真实姓名">
	                    </div>
	                </div>
	                <div class="form-group">
	                    <label class="col-sm-4 control-label">联系方式:</label>
	                    <div class="col-sm-8">
	                        <input type="text" class="form-control validate[required]" name="comnumPhone" 
	                        	id="comnumPhone" placeholder="联系方式">
	                    </div>
	                </div>
	            </div>   
               <div class="col-xs-12 col-md-6">
               			<div class="col-xs-12">
                          <div class="form-group">
                              <label class="col-xs-4 control-label">省:</label>
                              <div class="col-xs-8">
                                  <input type="text" class="form-control"  readonly="readonly" placeholder="省" name="comnumProvince" id="companyProvince">
                              </div>
                          </div>
                         </div>
                         <div class="col-xs-12">
                             <div class="form-group">
                                 <label class="col-xs-4 control-label">市:</label>
                                 <div class="col-xs-8">
                                     <input type="text" class="form-control"  readonly="readonly" placeholder="市" name="comnumCity" id="companyCity">
                                 </div>
                             </div>
                         </div>
                         <div class="col-xs-12">
                             <div class="form-group">
                                 <label class="col-xs-4 control-label">区:</label>
                                 <div class="col-xs-8">
                                     <input type="text" class="form-control"  readonly="readonly" placeholder="区" name="comnumArea" id="companyArea">
                                 </div>
                             </div>
                         </div>
                         <div class="col-xs-12">
	                   		<div class="form-group">
	                        <label class="col-xs-4 control-label">纬度:</label>
	                        <div class="col-xs-8">
	                            <input type="text" class="form-control"  readonly="readonly" name="comnumX" placeholder="纬度"  id = "lat">
	                        </div>
                   		</div>
                   </div>
                   <div class="col-xs-12">
                    <div class="form-group">
                        <label class="col-xs-4 control-label">经度:</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control"  readonly="readonly" name="comnumY" placeholder="经度"  id = "lng">
                        </div>
                    </div>
                   </div>
                   <div class="col-xs-12">
                    <div class="form-group">
                        <label class="col-xs-4 control-label">详细地址:</label>
                        <div class="col-xs-8">
                            <input type="text" class="form-control"  readonly="readonly" name="comnumAddr" placeholder="经详细地址"  id = "address">
                        </div>
                    </div>
                   </div>
                   <div class="col-xs-12">
                        <div class="form-group">
                            <label class="col-xs-4 control-label">详细地址搜索(输入所在地址):</label>
                            <div class="col-xs-8" style="position:relative">
                                <input type="text" class="form-control" placeholder="详细地址搜索"  id = "text" autocomplete="off">
								<div class="search">
								  <ul style="position:absolute; width:100%; left:0; top:-3px; z-index:9999; background: #fff;"></ul>
								</div>
                            </div>
                        </div>    
                     </div>
              </div>
              <div class="form-group">
	           </div>
              <div class="form-group" style="margin-top50px;">
              
                  <div class="col-sm-12 control-label" style="text-align:center;">
                      <button type="button" class="btn btn-default" onclick="closeForm();">关闭</button>
                       &nbsp;&nbsp;&nbsp;&nbsp;<button type="submit" class="btn btn-primary"  id="save" >保存</button>
                  </div>
              </div>
         </form>
    </div>
					  	<script charset="utf-8" src="http://map.qq.com/api/js?v=2.exp"></script>
						<script type="text/javascript" src="${pageContext.request.contextPath}/js/jsonp.js"></script>
					  	<script src="${pageContext.request.contextPath}/js/jquery-3.1.0.min.js"></script>
						<script type="text/javascript">
							var oText = document.getElementById('text');
							var oLat = document.getElementById('lat');
							var oLng = document.getElementById('lng');
							var oAddress = document.getElementById('address');
							var province = document.getElementById('companyProvince');
							var city = document.getElementById('companyCity');
							var district = document.getElementById('companyArea');
							var oSea = document.getElementsByClassName('search')[0];
							var oUl = document.getElementsByTagName('ul')[0];
							var oLl = document.getElementsByTagName('li');
							var z = -1;
							oText.onkeyup=function(event){
						           var val = this.value;
						           if(event.keyCode==38||event.keyCode==40){return}         
						            $.ajax({
						             type: "get",
						             async: false,
						             url: "http://apis.map.qq.com/ws/place/v1/suggestion",
						             data:{keyword:val,key: '3JMBZ-NWZWX-53J4X-TJOZS-VHEW6-YOFJZ',output: 'jsonp'},
						             dataType: "jsonp",
						             jsonp: "callback",//传递给请求处理程序或页面的，用以获得jsonp回调函数名的参数名(一般默认为:callback)
						             success: function(a){
						                  oUl.innerHTML="";
									    var frag = document.createDocumentFragment();
									    oSea.style.display=a.data!=""?"block":"none";
						                $.each(a.data,function(b,a,c){
						                  var oLi = document.createElement('li');
						                  oLi.innerHTML = '<a href="javascript:;" class="address" data-lng="'+a.location.lng+'" data-address="'+a.address+'" data-lat="'+a.location.lat+'" data-province="'+a.province+'" data-city="'+a.city+'" data-district="'+a.district+'">'+a.address+'</a>';
						                  frag.appendChild(oLi);
						                });
						                oUl.appendChild(frag);
						               document.onkeyup=function(event){
						    	        	if(event.keyCode==38){
						    	        		z--;
						    	        		if(z==-1){
						    	        			z=a.data.length-1;
						    	        		}
						    	        		for(var i=0,len=a.data.length;i<len;i++){
						                            if(oLl[i]!=oLl[z]){
						                            	oLl[i].childNodes[0].classList.remove('cur');
						                            }else{
						                            	oLl[z].childNodes[0].className='cur';
						                            }
						    	        		}
						    	        		oText.value=oLl[z].innerText;
						    	        	}else if(event.keyCode==40){
						    	              z++;
						    	              if(z==a.data.length){
						    	              	z=0;
						    	              }
						    	             for(var i=0,len=a.data.length;i<len;i++){
						                         if(oLl[i]!=oLl[z]){
						                         	oLl[i].childNodes[0].classList.remove('cur');
						                         }else{
						                         	oLl[z].childNodes[0].className='cur';
						                         }
						 	        		}
						    	        	  oText.value=oLl[z].innerText;
						    	        	}    	           
						    	        }
						             },
						         });
								};
					    $(function(){
					      $('body').on('click','.address',function(){
					        var lng = $(this).data('lng');
					        var lat = $(this).data('lat');
					        var address = $(this).data('address');
					        
					        var province = $(this).data('province');
					        var city = $(this).data('city');
					        var district = $(this).data('district');
					        getIcon(lat,lng,address,province, city,district)
					      });
					    })
					    function getIcon(a,b,c,d,e,f){
					                 oLat.value = a;
					                 oLng.value = b;
					                 oAddress.value = c;
					                 oText.value=null;
					                 $("#text").attr('placeholder','输入搜索地')
					                 province.value=d;
					                 city.value=e;
					                 district.value=f;
					                 $(".search").hide();
		/*			                  var latLng = new qq.maps.LatLng(a, b);
					                  //调用城市经纬度查询接口实现经纬查询
					                  citylocation.searchCityByLatLng(latLng);*/
					                }
							
						</script>
<script src="${pageContext.request.contextPath}/js/jquery.min.js?v=2.1.4"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap.min.js?v=3.3.6"></script>
<script src="${pageContext.request.contextPath}/js/content.min.js?v=1.0.0"></script>
<script src="${pageContext.request.contextPath}/js/plugins/layer/layer.min.js"></script>
<script src="${pageContext.request.contextPath}/js/public/ttbj-core.js"></script>
<script src="${pageContext.request.contextPath}/jQuery-Validation/js/jquery.validationEngine.js"></script>
<script src="${pageContext.request.contextPath}/jQuery-Validation/js/jquery.validationEngine-zh_CN.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap-fileinput/fileinput.min.js"></script>
<script src="${pageContext.request.contextPath}/js/bootstrap-fileinput/zh.js"></script>
<script src="${pageContext.request.contextPath}/laydate5.0.7/laydate.js"></script>
<script src="${pageContext.request.contextPath}/js/business/company/edit_company.js"></script>
</body>

</html>